/*
 * @(#)RedisBaseCacheImpl.java 2014-10-11 下午3:36:32
 * Copyright 2014 鲍建明, Inc. All rights reserved. 8637.com
 * PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package cn.singno.bob.redis.base.impl;

import org.springframework.cache.Cache;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.core.RedisTemplate;

import cn.singno.bob.redis.base.RedisBaseCache;

/**
 * <p>File：RedisBaseCacheImpl.java</p>
 * <p>Title: 
 * http://snowolf.iteye.com/blog/1666908
 * </p>
 * <p>Description:</p>
 * <p>Copyright: Copyright (c) 2014 2014-10-11 下午3:36:32</p>
 * <p>Company: 8637.com</p>
 * @author 鲍建明
 * @version 1.0
 */
public class RedisBaseCacheImpl<K, V> extends RedisCacheManager implements RedisBaseCache<K, V>
{
	private static String defaultCacheName = "DEFAULT_";
	
	protected Cache cache;
	
	private RedisTemplate<K, V> template;
	/**
	 * @param template
	 */
	public RedisBaseCacheImpl(RedisTemplate<K, V> template)
	{
		super(template);
		this.template = template;
		this.cache = super.getCache(defaultCacheName);
	}
	
	//设置数据连接始终为同一个
	public void setSinglePlop(){
		
	}
	
	
	public Long leftPushToList(K key, V value){
		return template.opsForList().leftPush(key, value);
	}
	
	public Long leftPushToList(K key, V... values){
		return template.opsForList().leftPushAll(key, values);
	}
	
	public Long rightPushToList(K key, V value){
		return template.opsForList().rightPush(key, value);
	}
	
	public Long rightPushToList(K key, V... values){
		return template.opsForList().rightPushAll(key, values);
	}
	
	public Long getIndexToList(K key){
		return template.opsForList().getOperations().getExpire(key);
	}
	
	public void remove(K key, Long index){
		//return template.opsForList().remove(key, i, value);
	}
	
	
}
